package org.crazyit.activiti_d5._3_Interceptor;

import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.interceptor.CommandInterceptor;

import java.util.ArrayList;

public class TestConfiguration extends ProcessEngineConfigurationImpl {

    public CommandInterceptor createTransactionInterceptor() {

        //不实现事务拦截器
        return null;

    }

    /**
     * 重写初始化命令拦截器方法
     */
    public void initCommandInterceptors(){

        //1. 为父类的命令集合添加拦截器
        customPreCommandInterceptors = new ArrayList<CommandInterceptor>();

        //2. 依次将A和B两个连接器加入集合 (责任链)
        customPreCommandInterceptors.add(new InterceptorA());
        customPreCommandInterceptors.add(new InterceptorB());

        //3. 再调用父类的实例化方法
        super.initCommandInterceptors();

    }

}
